package
{
	import UIFree.uif_app;
	import UIFree.uif_ecomponent;
	import UIFree.uif_styles;
	
	import UIUtils.uif_MLPEncoder;
	
	import classes.c_imageTypes;
	import classes.c_styles;
	import classes.c_urls;
	import classes.c_util;
	
	import MLP.mlp_effectLayer;
	import MLP.mlp_effects;
	import MLP.multiLayerObject;
	
	import flash.display.Bitmap;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.PerspectiveProjection;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.utils.ByteArray;
	
//	[SWF(width="600", height="400", backgroundColor="#FFFFFF")]
	public class mlpdemo3 extends uif_app {
		private var _result	: multiLayerObject;
		private var _mask	: uif_ecomponent;
		public function mlpdemo3() {
			mlp_effectLayer.URLPATH = c_urls.EFFECTURL;
			super(new c_styles());
			
			styleClass = 'application';
			resize(stage.stageWidth, stage.stageHeight);
			
			var pj: PerspectiveProjection = new PerspectiveProjection();
			pj.projectionCenter = center;
			transform.perspectiveProjection = pj;
			
			function doComplete(e: Event): void {
				uif_MLPEncoder.decode((e.target as URLLoader).data as ByteArray, function(bmps: Array): void {
					_result = new multiLayerObject();
					_result.addLayers(bmps);
					_result.x = (width - _result.width) / 2;
					_result.y = (height - _result.height) / 2;
					
					//_mask = new uif_ecomponent(This, _result.x, _result.y, _result.width, _result.height, 'white');
					addChild(_result);
				});
			}
			
			var loader: URLLoader = new URLLoader();
			loader.addEventListener(Event.COMPLETE, doComplete);
			loader.dataFormat = URLLoaderDataFormat.BINARY;
			
			loader.load(new URLRequest(stage.loaderInfo.parameters.image));
		}
		
	}
}